package com.china08.yxyapi.util;


import java.util.List;

/**
 * Created by 赵亚辉 on 2017/7/21.
 */
public class PageModel <T>{

    private Integer pageIndex=1;

    private Integer pageSize=10;

    private List<T> list;

    private Integer totalCount=0;

    private Integer totalPage=0;

    private Integer upPage=0;

    private Integer nextPage;

    public void setPage(Integer pageIndex,List<T> list,Integer totalCount){

        this.pageIndex=pageIndex;
        this.list=list;
        this.totalCount=totalCount;
        this.totalPage = totalCount%pageSize==0?totalCount/pageSize:(totalCount/pageSize+1);
        this.upPage=this.pageIndex>1?this.pageIndex-1:pageIndex;
        this.nextPage=this.pageIndex>=this.totalPage?this.totalPage:this.pageIndex+1;
    }
    

    public Integer getUpPage() {
        return upPage;
    }

    public void setUpPage(Integer upPage) {
        this.upPage = upPage;
    }

    public Integer getNextPage() {
        return nextPage;
    }

    public void setNextPage(Integer nextPage) {
        this.nextPage = nextPage;
    }

    public Integer getTotalPage() {
        return totalPage;
    }

    public void setTotalPage(Integer totalPage) {
        this.totalPage = totalCount%pageSize==0?totalCount/pageSize:(totalCount/pageSize+1);
    }

    public Integer getPageIndex() {
        return pageIndex;
    }

    public void setPageIndex(Integer pageIndex) {
        this.pageIndex = pageIndex;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    public Integer getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(Integer totalCount) {


        this.totalCount = totalCount;
    }
}
